package com.lcc.lynx.jdbc.qw;

import lombok.Data;

import java.util.List;

/**
 * @author lcc
 * @date 2025/7/23 17:17
 */
@Data
public class TableJoin {

    public static final String LEFT_JOIN = " left join ";
    public static final String RIGHT_JOIN = " right join ";
    public static final String INNER_JOIN = " inner join ";
    public static final String JOIN = " join ";
    public static final String DEFAULT_JOIN = ", ";

    private QueryWrapper queryWrapper;

    private TableDef tableDef;

    private String joinType;

    private String tableName;

    private String as;

    private List<QueryCondition> joinQueryConditionList;

    public TableJoin(TableDef tableDef, String joinType) {
        this.tableDef = tableDef;
        this.joinType = joinType;
        this.tableName = tableDef.getTableName();
    }

    public TableJoin(QueryWrapper queryWrapper, String joinType) {
        this.queryWrapper = queryWrapper;
        this.joinType = joinType;
    }

    public TableJoin(TableDef tableDef) {
        this.tableDef = tableDef;
        this.joinType = DEFAULT_JOIN;
        this.tableName = tableDef.getTableName();
    }

    public TableJoin(String tableName, String as, String joinType) {
        this.tableName = tableName;
        this.as = as;
        this.joinType = joinType;
    }
}
